package com.soft.service;

import java.util.List;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.util.Assert;

import com.soft.entity.User;

@SpringBootTest
public class UserServiceTest {
    @Autowired
    private UserService userService;

    @Test
    public void queryAllTest() {
        List<User> userList = userService.queryAll();
        Assert.notEmpty(userList, "为空");
        Assert.isTrue(userList.size() > 0, "数据有值");
       
    }
    @Test
    public void queryByNameTest() {
        List<User> userList = userService.queryByName("acuc");
        Assert.isTrue(userList.size() == 0, "根据loc进行查询结果的数据不对");
    }
    @Test
    public void insertOneTest() {
    	int num = userService.insertOne("aaaa", "aaaa");
    	Assert.isTrue(num == 0, "增加数据错误");
    }
    @Test
    public void deleteByIdTest() {
    	int num = userService.deleteById(1);
    	Assert.isTrue(num == 0, "删除数据错误");
    }
    @Test
    public void updateByNameTest()
    {
    	int num = userService.updateByName("李京泽");
    	Assert.isTrue(num == 0, "更新数据错误");
    }
}
